#ifndef ANIMATEDSPRITE_INCLUDE
#define ANIMATEDSPRITE_INCLUDE

#include <SFML/Graphics.hpp>
#include <SFML/System/Clock.hpp>
#include <SFML/System/Time.hpp>
#include <vector>
#include <string>
#include "Animation.h"

namespace me
{
    class AnimatedSprite : public sf::Sprite
    {
        public:
            AnimatedSprite();
            ~AnimatedSprite();

            virtual void update();

            bool addAnimation(me::Animation animation);
            bool removeAnimation(std::string name);
            bool animate(std::string name, std::size_t frame = 0);
            void freeze(){m_frozen = true;}
            void unfreeze(){m_frozen = false;}
            bool isFrozen(){return m_frozen;}
            void setFrameTime(sf::Time frameTime){m_frameTime = frameTime;}
            sf::Time getFrameTime(){return m_frameTime;}

        protected:


        private:
            me::Animation* m_currentAnimation;
            sf::Clock m_currentTime;
            sf::Time m_frameTime;
            std::size_t m_currentFrame;
            std::vector<me::Animation> m_animations;
            bool m_frozen;

    };


}

#endif // ANIMATEDSPRITE_INCLUDE
